<?php


namespace app\index\controller;


use app\BaseController;
use app\index\business\newsBus;
use think\facade\View;

class News extends BaseController
{
    public function index(){
        View::assign('title','资讯列表');
        return View::fetch();
    }
    public function detail(){
        $id = $this->request->param('id');
        View::assign('title','资讯详情');
        View::assign('id',$id);
        return View::fetch();
    }
    public function getListPage(){
        $paging = $this->request->param('paging');
        $where = [
            'status'=>1
        ];
        $newsBus = new newsBus();
        try {
            $res = $newsBus->getListPageBus($where,$paging);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    public function getDetail(){
        $id = $this->request->param('id');
        $newsBus = new newsBus();
        try {
            $res = $newsBus->getDetailBus($id);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
}